# -*- coding: utf-8 -*-
# Created by admin on 2020/3/20
# Copyright (c) 2020 admin. All rights reserved.
import os
#获取当前的目录
print(os.getcwd())
#创建一个目录
# os.mkdir('dir01')
# os.makedirs('dir02\\subdir01')
#转换到目录
# os.chdir('dir01')
# print(os.getcwd())

# os.chdir('..')  # ..代表上一级目录
# print(os.getcwd())

#文件重命名
# os.rename('dir01','dirnew01')
path = os.getcwd()

fileName = os.path.join(path,'dirnew01\\test01.py')
'''
绝对路径：'D:\test\runoob'
相对路径：'dirnew01\\test01.py' 相对于当前文件夹的路径
'''
print(fileName)
if os.path.isdir(fileName):
    print('rmdir')
    os.rmdir(fileName)
else:
    print('remove')
    os.remove(fileName)

